package com.seal.commons.core.entity.id;

import com.seal.commons.utils.id.UniqueIdUtils;
import org.hibernate.HibernateException;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.id.IdentityGenerator;

import java.io.Serializable;

/**
 * 功能描述: <br/>
 *
 * @author yong.huang
 * @date: 2020-06-15 22:25<br/>
 * @since JDK 1.8
 */
public class SnowflakeIdGenerator extends IdentityGenerator {

    @Override
    public Serializable generate(SharedSessionContractImplementor session, Object object) throws HibernateException {
        return UniqueIdUtils.snowflakeId();
    }


}